﻿using System.Threading;
using Wedn.Net.Common;

namespace Wedn.Net.UI.SiteStatistics
{
    /// <summary>
    /// 站点统计类
    /// </summary>
    public static class SiteStatistics
    {
        /// <summary>
        /// 浏览开始
        /// </summary>
        public static void View()
        {
            var thread = new Thread(SaveToDb);
            thread.Start();
        }
        /// <summary>
        /// 保存到数据库
        /// </summary>
        public static void SaveToDb()
        {
            while (true)
            {
                Thread.Sleep(20000);
                //更新流量次数
                BLLFactory.BLLFactory.Instance.OptionManager.UpdateValue("site_view_count", Setting.SiteViewCount.ToString());
                BLLFactory.BLLFactory.Instance.OptionManager.SaveChanges();
            }
        }
    }
}
